var mongoose = require('mongoose');
var mongokeeper = require('./mongokeeper');
var Schema = mongoose.Schema;
var articleModel = function () {
    var articleSchema = new Schema({
        app_ame: String,
        username: String,
        app_type: String,
        down_path: String,
        down_size: String,
        version: String,
        version_des: String,
        img: String,
        pictures: [{url: String, width: Number, height: Number}], // 配图
        thumbnails: [{url: String, width: Number, height: Number}], // 缩略图
        create_date: {type: Date, default: Date.now}, //创建时间
        meta: {
            votes: Number, //顶
            favs: Number  //收藏
        }
    });
    //因为使用了createConnection 这里要使用mongokeeper.db.model
    //而不是mongoose.model
    return mongokeeper.db.model('applist', articleSchema);
};

module.exports = new articleModel();
